package com.zegome.uis;

import aurelienribon.tweenengine.Timeline;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenEquations;
import aurelienribon.tweenengine.TweenManager;

import com.badlogic.gdx.scenes.scene2d.Actor;

public class TimelineTemplate {
	
	static public Timeline AppearZoomIn(Actor actor, float waittime, float timeact){
		return Timeline.createSequence()
				.push(Tween.set(actor, ActorAccessor.OPACITY).target(0f))
				.push(Tween.set(actor, ActorAccessor.SCALE_XY).target(6f, 6f))
				.pushPause(waittime)
				.push(Timeline.createParallel()
						.push(Tween.to(actor, ActorAccessor.OPACITY, timeact).target(1f))
						.push(Tween.to(actor, ActorAccessor.SCALE_XY, timeact).target(1f, 1f).ease(TweenEquations.easeOutBounce))
						);
	}
	
	static public Timeline AppearAlpha(Actor actor, float waittime, float timeact){
		return Timeline.createSequence()
				.push(Tween.set(actor, ActorAccessor.OPACITY).target(0f))
				.pushPause(waittime)
				.push(Tween.to(actor, ActorAccessor.OPACITY, timeact).target(1f));
	}
	
	static public Timeline AppearZoomOut(Actor actor, float waittime, float timeact){
		return Timeline.createSequence()
				.push(Tween.set(actor, ActorAccessor.SCALE_XY).target(0f, 0f))
				.pushPause(waittime)
				.push(Tween.to(actor, ActorAccessor.SCALE_XY, timeact).target(1f, 1f).ease(TweenEquations.easeOutBounce));

	}
	
	static public Timeline DisappearZoomIn(Actor actor, float waittime, float timeact){
		return Timeline.createSequence()
				.pushPause(waittime)
				.push(Tween.to(actor, ActorAccessor.SCALE_XY, timeact).target(0f, 0f).ease(TweenEquations.easeInBounce));
	}

	
	static public Timeline DisappearZoomOut(Actor actor, float timeact){
		return Timeline.createParallel()
					.push(Tween.to(actor, ActorAccessor.OPACITY, timeact).target(0f))
					.push(Tween.to(actor, ActorAccessor.SCALE_XY, timeact).target(6f, 6f));
	}
	
	static public Timeline DisappearZoomLitteOut(Actor actor, float timeact){
		return Timeline.createSequence()
				.push(Tween.to(actor, ActorAccessor.SCALE_XY, timeact).target(1.5f, 1.5f).repeatYoyo(1, 0f));
	}
	
	static public void ResetActor(Actor actor, TweenManager manager){
		Timeline.createParallel()
			.push(Tween.set(actor, ActorAccessor.OPACITY).target(1f))
			.push(Tween.set(actor, ActorAccessor.SCALE_XY).target(1f,1f))
			.start(manager);
	}
	
}
